﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProjectDetial.aspx.cs" Inherits="WebApplication2.Web.ProjectDetial" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <script src="../../lib/layui/layui.js"></script>
    <link href="../../css/font.css" rel="stylesheet" />
    <link href="../../css/xadmin.css" rel="stylesheet" />
    <link href="../css/viewer.min.css" rel="stylesheet" />
    <script src="../../js/jquery-3.2.1.min.js"></script>
    <script src="../js/public.js"></script>
    <script src="../js/xadmin.js"></script>
    <script src="../js/cookie.js"></script>
    <script src="../js/viewer.min.js"></script>
    <title>项目详细</title>
</head>
<body>
    <style>
        .layui-upload .mark_button {
            position: absolute;
            right: 15px;
        }

        .upload-img {
            position: relative;
            display: inline-block;
            width: 300px;
            height: 200px;
            margin: 0 10px 10px 0;
            transition: box-shadow .25s;
            border-radius: 4px;
            box-shadow: 0px 10px 10px -5px rgba(0, 0, 0, 0.5);
            transition: 0.25s;
            -webkit-transition: 0.25s;
            margin-top: 15px;
        }

        .layui-upload-img {
            width: 300px;
            height: 200px;
            border-radius: 4px;
        }

        .upload-img:hover {
            cursor: pointer;
            box-shadow: 0 0 4px rgba(0,0,0,1);
            transform: scale(1.2);
            -webkit-transform: scale(1.05);
        }

        .upload-img input {
            position: absolute;
            left: 0px;
            top: 0px;
        }

        .upload-img button {
            position: absolute;
            right: 0px;
            top: 0px;
            border-radius: 6px;
        }
    </style>

      <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
            <legend>项目基本信息</legend>
        </fieldset>
    <div class="x-body layui-anim layui-anim-up " id="xx-body">
        <form class="layui-form " action="">
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span>预算编号：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="id"></span>
                </div>
            </div>

             <div class="layui-form-item">
                <label class="layui-form-label">
                    <span>项目编号：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="NewID"></span>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span>项目名：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="name"></span>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span>负责人：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="chargeman"></span>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span>引入时间：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="input"></span>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span>预计完成：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="finish"></span>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span>预算：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="budget"></span>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span>项目产值：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="value"></span>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span>剩余预算：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="realbudge"></span>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span>电气设计：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="ed"></span>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span>电气装配：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="ec"></span>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span>机械设计：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="md"></span>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span>机械装配：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="mc"></span>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span>项目状态：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="status">设计中</span>
                </div>
            </div>

              <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span>资本化和费用化：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="Caps">资本化</span>
                </div>
            </div>

              <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span>项目类型：</span>
                </label>
                <div class="layui-form-mid">
                    <span class="content" id="Protype">改造项目</span>
                </div>
            </div>

        </form>
    </div>

      <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
            <legend>PR单</legend>
       </fieldset>

    <table class="layui-hide" id="demo1" lay-filter="demo">
          <script type="text/html" id="option">
            <a class="layui-btn layui-btn-xs " lay-event="update">填写合同信息</a>
            <a class="layui-btn layui-btn-xs layui-btn layui-btn-danger" lay-event="delete">删除</a>
        </script>

    </table>

    <div class="layui-upload ">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
            <legend>图片信息</legend>
        </fieldset>

        <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
            <div class="box">
                <div id="photosDemo" class="photos-demo">
                    <img  layer-src="../images/bg.png" layer-pid="" src ="../images/bg.png" />
                </div>
            </div>
        </blockquote>

         <style>
     
        .box{padding:20px; background-color:#fff; border-radius:5px;}
        
            img {
            position: relative;
            display: inline-block;
            width: 300px;
            height: 200px;
            margin: 0 10px 10px 0;
            transition: box-shadow .25s;
            border-radius: 4px;
            box-shadow: 0px 10px 10px -5px rgba(0, 0, 0, 0.5);
            transition: 0.25s;
            -webkit-transition: 0.25s;
            margin-top: 15px;
        }

            img:hover {
            cursor: pointer;
            box-shadow: 0 0 4px rgba(0,0,0,1);
            transform: scale(1.2);
            -webkit-transform: scale(1.05);
        }

    </style>
  
  
    </div>
    <script>
        layui.use(['layer', 'form', 'carousel','table'], function () {
            var layer = layui.layer;
            var form = layui.form;
            var carousel = layui.carousel;
            var table = layui.table;
            //使用相册模块
            layer.photos({
                //area: ['1200px', '600px'],
                photos: '#photosDemo'
                , anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机
            });

            //监听单元格编辑
            table.on('edit(demo)', function (obj) {
                var value = obj.value //得到修改后的值
                    , data = obj.data //得到所在行所有键值
                    , field = obj.field; //得到字段
                layer.msg('[ID: ' + data.id + '] ' + field + ' 字段更改为：' + value);
            });

            var obj = new Object();
            obj.project_id = getCookie("id");
            myAjax("FileHandler.ashx", "getURL", obj, true, function (data) {
                console.log(data);
                for (x in data.Obj) {
                    //console.log(data.Obj[x].FileName)
                    //< img  src= "http://localhost:8268/Upload/2018110611422200_pic1.png" >
                    var tipe = "<img src=\"http://localhost:8268/Upload/" + data.Obj[x].FileName + "\">"
                    //console.log(tipe);
                    $('#photosDemo').append(tipe);
                }
     
            })


            //监听‘操作’列里的按钮
            table.on('tool(demo)', function (obj) {
                var data = obj.data;
                if (obj.event === 'delete') {
                    layer.confirm('确定删除?', function (index) {
                        obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
                        layer.close(index);
                        //向服务器发出删除Ajax请求
                        var objdel = new Object();
                        objdel.pr_id = data.Pr_id;
                        myAjax("BudgetHandler.ashx", "delete", objdel, false, function (data) {
                            if (data.Code == 1) {
                                layer.msg('删除成功');
                            }

                        });
                    });
                } 
                if (obj.event === 'update') {
                    setCookie("pr_id", data.Pr_id);
                    x_admin_show('补充合同信息', './AddPRLess.aspx');
                    console.log("cookie:" + getCookie("pr_id"));
                } 
            });

            myAjax("BudgetHandler.ashx", "query", obj, true, function (data) {
               
                //填充表格
                table.render({
                    elem: '#demo1'
                    ,toolbar: 'true' //让工具栏左侧显示默认的内置模板
                    , cols: [[ //标题栏
                        { field:   'Pr_id', title: 'PR单号' }
                        , { field: 'Pr_budget', title: 'PR单申请金额' }
                        , { field: 'Applicants', title: '申请人' }
                        , { field: 'App_time', title: '申请时间' }
                        , { field: 'Content', title: '申请内容' }
                        , { field: 'C_id', title: '合同编号' }
                        , { field: 'C_time', title: '合同签订时间' }
                        , { field: 'C_budget', title: '合同金额' }
                        , { field: 'Shopman', title: '采购人' }
                        , { field: 'option', title: '操作', templet: "#option", width:'163'}
                    ]]
                    , data: data.Obj
                    , even: true
                    , page: true //是否显示分页
                    , limits: [5, 7, 10]
                    , limit: 7 //每页默认显示的数量
                });

            })
         
         
            // console.log(getCookie("edesign"));
            $("#name").text(getCookie("name"));
            $("#id").text(getCookie("id"));
            $("#chargeman").text(getCookie("chargeman"));
            $("#input").text(getCookie("input"));
            $("#userarea").text(getCookie("userarea"));
            $("#finish").text(getCookie("finish"));
            $("#budget").text(getCookie("budget"));
            $("#realbudge").text(getCookie("lessbudget"));
            $("#md").text(getCookie("mdesign"));
            $("#mc").text(getCookie("mcharge"));
            $("#ec").text(getCookie("echarge"));
            $("#ed").text(getCookie("edesign"));
            $("#value").text(getCookie("value"));
            $("#Caps").text(getCookie("caps"));
            $("#Protype").text(getCookie("protype"));
            $("#NewID").text(getCookie("NewID"));
         

            if (getCookie(status == 0)) {
                $("#status").text('方案评审');
            } else if (getCookie(status == 1)) {

                $("#status").text('方案评审');
            } else if (getCookie(status == 2)) {

                $("#status").text('加工中');
            } else if (getCookie(status == 3)) {

                $("#status").text('装备调试');
            } else if (getCookie(status == 4)) {

                $("#status").text('已完成');
            }
        });

    </script>
</body>
</html>
